# 线程之间的执行是无序的
import threading
import time

items = []


def write_data():
    for i in range(5):
        items.append(i)
        time.sleep(1)
    print("write data is:", items)


def read_data():
    print("read data is", items)


if __name__ == "__main__":
    p1 = threading.Thread(target=write_data)
    p2 = threading.Thread(target=read_data)
    p1.start()
    p1.join()
    p2.start()
    p2.join()
